import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPersist from 'pinia-plugin-persist'
import "animate.css/animate.min.css"
import { isPhone } from '@/utils/util'

// 1. 引入你需要的组件
import { 
    Button,
    Image, 
    NavBar, 
    Cell, 
    CellGroup, 
    Field, 
    Picker,
    Form,
    Popup,
    Calendar,
    DatetimePicker,
    Notify,
    RadioGroup,
    Radio,
    Stepper,
    Checkbox,
    Lazyload,
    List,
    PullRefresh,
    Collapse,
    CollapseItem,
    ActionSheet,
    Dialog,
    Toast,
    Swipe,
    SwipeItem,
    Loading,
    Tab,
    Tabs,
} from 'vant'
// 2. 引入组件样式
import 'vant/lib/index.css'
//vant swipe在pc端可以滑动
import '@vant/touch-emulator'

import App from './App.vue'
import router from './router'
import directive from './directive'

import './assets/style/index.scss'

const app = createApp(App)

const pinia = createPinia()
pinia.use(piniaPersist)

app.use(pinia)
app.use(router)
app.use(directive)
app.use(Button)
app.use(Image)
app.use(NavBar)
app.use(Cell)
app.use(CellGroup)
app.use(Field)
app.use(Picker)
app.use(Form)
app.use(Popup)
app.use(Calendar)
app.use(DatetimePicker)
app.use(Notify)
app.use(RadioGroup)
app.use(Radio)
app.use(Stepper)
app.use(Checkbox)
app.use(List)
app.use(PullRefresh)
app.use(Collapse)
app.use(CollapseItem)
app.use(ActionSheet)
app.use(Swipe)
app.use(SwipeItem)
app.use(Dialog)
app.use(Toast)
app.use(Lazyload)
app.use(Loading)
app.use(Tab)
app.use(Tabs)



app.use(Lazyload, {
    lazyComponent: true,
})
// if(!isPhone()) {
//     router.replace({path:'/404', query:{reason:'抱歉，该页面无法访问，请使用手机访问试试！',mes:'404...'}}) 
// }

app.mount('#app')
